package com.one.group.user.tool;

import com.one.group.model.dto.SpSendEmailDto;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MqMassageTool {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    public void send(SpSendEmailDto spSendEmailDto) {
        rabbitTemplate.setMessageConverter(new Jackson2JsonMessageConverter());
        rabbitTemplate.convertAndSend("gxa.direct","sendEmail",spSendEmailDto);
    }
}
